<link href="static/style/global.css" rel="stylesheet" type="text/css" />
<link href="static/style/reg.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.login_ajax_tab{ font-size:14px; margin-bottom:20px; border-bottom:3px solid #eee;height: 30px;display: block;clear: both;}
.login_ajax_tab span{ background:#f2f2f2; padding:9px 20px; display:inline; cursor:pointer;}
.login_ajax_tab .selected{ font-weight:600; background:#999; color:#fff;cursor: default;}
.m-box-reg{}
.m-box-reg .check_email_result2{margin-top: 30px;left: 5px;margin-left: 0;}
</style>

<div class="m-box">
<dl class="login_ajax_tab"><span class="selected">登录</span><span>注册</span></dl>
<div class="login_ajax_content">

	<ul class="m-box-reg" style="width:65%;">
    <!--{eval $login_extract=jsg_member_login_extract();}-->
	<!--{if $login_extract && (($login_extract_forms=$login_extract[login_forms]) || ($login_extract_html=$login_extract[login_html]))}-->
	<!--{if $login_extract_forms}-->
	<form method="{$login_extract_forms[method]}" action="{$login_extract_forms[action]}">
	  <!--{loop $login_extract_forms[hidden_inputs] $v}-->
	  <input type="hidden" name="{$v[name]}" value="{$v[value]}" />
	  <!--{/loop}-->
		<table width="100%" border="0">
		  <tr>
            <td align="right" valign="middle" width="60">帐号：</td>
			<td>
            <input name="username" type="text"  class="u-ipt" id="username_input" onblur="logincheckUsername(this.value);" value="$this->Config['changeword']['username']" onfocus="this.value=''"/>
            <div id="username_tip"></div>
			</td>
		  </tr>
          
		  <tr>
            <td align="right" valign="middle" width="60">密码：</td>
			<td>
            <input name="password" type="password" class="u-ipt"  placeholder="请输入密码"/>
			</td>
		  </tr>
	
		  <tr>
			<td>	
			<input name="{$login_extract_forms[submit_input][name]}" type="submit" value="{$login_extract_forms[submit_input][value]}" class="u-btn" onclick="guestLoginSubmit();"/>	
			</td>
		  </tr>

		</table>
	</form>
		  <!--{else}-->
			<!--{if $login_extract_html}-->{$login_extract_html}<!--{/if}-->
		  <!--{/if}-->
	<!--{else}-->
	<form method="POST" action="index.php?mod=login&code=dologin">
		<table width="100%" border="0">
		  <tr>
          <td align="right" valign="middle" width="60">帐号：</td>
			<td>
            <input name="username" type="text"  class="u-ipt" id="username_input" onblur="logincheckUsername(this.value);if(this.value==''){this.value='$this->Config['changeword']['username']';}" value="$this->Config['changeword']['username']" onfocus="this.value=''"/>

            <div id="username_tip"></div>
            </td>
		  </tr>
		  <tr>
          <td align="right" valign="middle" width="60">密码：</td>
			<td>
            <input name="password" id="password_input" type="password" class="u-ipt" placeholder="请输入密码"/>
			</td>
		  </tr>
		  <!--{if $this->Config['seccode_enable']==1 && $this->Config['seccode_login']}-->
		<tr>
        <td align="right" valign="top" width="60">验证码：</td>
			<td>
            	<input name="seccode" id="seccode_input" type="text" class="u-ipt" style="width:80px;" onclick="get_seccode('log');"/>
				<span id="log_seccode_tips"></span>
                <p class="u-verify">
                <span id="log_seccode"></span><span id="log_seccode_h" style="display:none;"><a href="javascript:updateSeccode('seccode_input','log_image_seccode');">换一换</a></span>
                </p>			
			</td>
		</tr>
	  	<!--{/if}-->
		  <tr>
          <td align="right" valign="middle" width="60">&nbsp;</td>
			<td style="font-size:12px;">	
            <label for="savelogin"><input type="checkbox" id="savelogin" name="savelogin" value="1" class="checkb"  title="请不要在公共电脑上使用自动登录功能">记住帐号</label>&nbsp;&nbsp;
			 <a href="javascript:void(0)" title="点此可通过2种方式重设密码" target="_blank" onclick="window.location.href='index.php?mod=get_password';return false;">忘记密码</a>
			</td>
		  </tr>
		  <tr>
          <td align="right" valign="middle" width="60">&nbsp;</td>
			<td>
			<!--{if $this->Config['seccode_login'] && $this->yxm_title}-->
			<input name="" type="button" value="登 录" class="u-tbn u-btn-lg" onclick="YXM_popBox(this,'login','{$this->yxm_title}');"/>
			<!--{else}-->
			<input name="" type="button" value="登 录" class="u-btn u-btn-lg" onclick="guestLoginSubmit();"/>
			<!--{/if}-->
			<input name="loginType" type="hidden" id="loginType" value="show_login" />
			<input name="return_url" type="hidden" id="return_url" value="登 录" />	
		
			</td>
		  </tr>
		</table>
	</form>
	<!--{/if}-->
    </ul>
 
<!--新增注册切换部分-->
<style type="text/css">
.m-box-reg .u-tips{ display:block; float:left; margin:0;width: 260px;}
#regtabhtml tr td{padding:0px 5px;}
</style>
 <ul id="regtabhtml" class="m-box-reg" style="width:65%; display:none">
	<!--{if $reg_error_msg}-->
	<p style="text-align:center;margin-top:30px;">{$reg_error_msg}</p>
	<!--{else}-->
      <form method="post" action="index.php?mod=member&code=doregister" name='reg' id="member_register">
        <input type="hidden" id="referer_input" name="referer" value="{$referer}">
        <table width="100%" border="0">		  
		
          <tr>
            <td align="right" valign="top" width="90">常用Email：</td>
            <td><input type="text" name="email" id="email_input" value="" class="u-ipt">
              <div class="u-tips">需要验证Email，用于登录和取回密码等</div>
              </td>
          </tr>
		
          <tr>
            <td align="right" valign="top">{$this->Config['changeword']['account']}：</td>
            <td><input name="nickname" type="text" id="nickname_input" maxlength="50"  class="u-ipt">
              <div class="u-tips">中英文均可，用于显示、@通知和发私信等</div>
              </td>
          </tr>
          <tr>
            <td align="right" valign="top">登录密码：</td>
            <td><input type="password" name="password" id="password" maxlength="32" class="u-ipt">
              <div class="u-tips">密码至少5位</div></td>
          </tr>
		  <tr>
            <td align="right" valign="middle">确认密码：</td>
            <td><input type="password" name="password2" id="password2" maxlength="32" class="u-ipt">
			<div class="u-tips">与登录密码保持一致</div></td>
          </tr>
		  <!--{if $this->Config['seccode_enable']==1 && $this->Config['seccode_register']}-->
			  <tr>
				<td align="right" valign="top" style="vertical-align:top; padding-top:13px;">验证码：</td>
				<td>
				  <p><input type="text" name="seccode" id="reg_seccode_input" class="u-ipt u-ipt-1" onclick="get_seccode('reg');"/><span id="reg_seccode_tips"></span></p>		  
				  <p class="u-verify">
				  <span id="reg_seccode"></span><span id="reg_seccode_h" style="display:none;"><a href="javascript:updateSeccode('reg_seccode_input','reg_image_seccode');">换一换</a></span></p>				  
				  </td>
			  </tr>
		<!--{/if}-->
          <tr>
            <td align="right" valign="middle">&nbsp;</td>
            <td>
              <input name="copyrightInput" type="checkbox" id="copyrightInput" onclick="regCopyrightSubmit();" value="1" checked="checked" />
              <a href="index.php?mod=other&code=regagreement" target="_blank" style="font-size:12px; color:#999;">我已看过并同意《使用协议》</a>
            </td>
          </tr>
          <tr>
            <td align="right" valign="middle">&nbsp;</td>
            <td>
              <!--{if $this->Config['seccode_enable']>1 && $this->Config['seccode_register'] && $this->yxm_title}-->
			  <input type="hidden" name="add_YXM_input_result" id="add_YXM_input_result">
			  <input type="hidden" name="add_YXM_level" id="add_YXM_level">
			  <input type="hidden" name="add_YinXiangMa_challenge" id="add_YinXiangMa_challenge">
			  <input id="regSubmit" class="u-btn u-btn-lg" type="button" value="注 册" onclick="check_submit(this,1,'{$this->yxm_title}');"/>
			  <!--{else}-->
			  <input id="regSubmit" class="u-btn u-btn-lg" type="button" value="注 册" onclick="check_submit(this,0,'');"/>
			  <!--{/if}-->
            </td>
          </tr>
        </table>
      </form>
	  <!--{/if}-->
    </ul>
 <script type="text/javascript">
function regCopyrightSubmit() {
	document.getElementById('regSubmit').disabled = !document.getElementById('copyrightInput').checked;
}
function testEmail(str){
	var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	if(reg.test(str)){return true;}else{return false;}
}
function message_window(str){show_message(str,2,'提示','msgBox','msg_alert');}
function check_submit(obj,type,title){
	var rstr = '';var semail = $('#email_input').val();var snickname = $('#nickname_input').val();var spassword = $('#password').val();var spassword2 = $('#password2').val();
	if(semail==''){rstr = 'E-mail不能为空';}else if(!testEmail(semail)){rstr = 'E-mail地址输入错误';}else if(snickname==''){rstr = '昵称不能为空';}else if(spassword==''){rstr = '密码不能为空';}else if(spassword.length<5){rstr = '密码至少5位';}else if(spassword2==''){rstr = '请输入确认密码';}else if(spassword!=spassword2){rstr = '两次密码不一致';}else if($("#reg_seccode_input").length>0 && $("#reg_seccode_input").val()==''){rstr = '请输入验证码';}
	if(rstr){message_window(rstr);rstr='';}else{ajax_check(obj,semail,snickname,type,title);}
}
function ajax_check(obj,email,nickname,type,title){
	message_window('正在对您提交的数据进行验证');
	if($("#reg_seccode_input").length>0 && $("#reg_seccode_input").val()){var seccode = $("#reg_seccode_input").val();}else{var seccode=''}
	var myAjax = $.post('ajax.php?mod=member&code=check_ajax_reg',{nickname:nickname,email:email,seccode:seccode,type:type},function(r){message_window(r.msg);if(r.done!=false){if(type){YXM_popBox(obj,'reg,member_register',title);}else{$('#member_register').submit();}}},'json');
}
function kreg_buttom(){$('.login_ajax_tab span').eq(1).addClass("selected").siblings().removeClass();$(".login_ajax_content > ul").eq(1).show().siblings().hide();$("#logmhtml").show();$("#regmhtml").hide();}
function klog_buttom(){$('.login_ajax_tab span').eq(0).addClass("selected").siblings().removeClass();$(".login_ajax_content > ul").eq(0).show().siblings().hide();$("#regmhtml").show();$("#logmhtml").hide();}
</script>
<!--{if $this->Config['seccode_enable']==1 && $this->Config['seccode_register'] && !$reg_error_msg}-->
<script language="javascript">$(document).ready(function(){$("#reg_seccode_input").blur(function(){checkSeccode($("#reg_seccode_input").val(), {"tips_id":"reg_seccode_tips"});});});</script>
<!--{/if}-->
 <!--新增注册切换部分 END--> 
 </div>    
    
    
    <div class="m-box-side" style="width:32%; height:100%; margin-left:15px;">
 	<div id="regmhtml">
		<p class="u-tips">还没注册过本站帐户？<a title="注册{conf site_name}" onclick="kreg_buttom();return false;" >注册{conf site_name}</a></p>
		<p class="u-tips">注册后，可以方便地分享新鲜事，关注用户分享；并可通过手机随时随地参与互动。</p>
		</div>
		<div id="logmhtml" style="display:none;">
		<p class="u-tips">已经是本站的注册用户？<a title="登录{conf site_name}" onclick="klog_buttom();return false;" >直接登录</a></p>
		<p class="u-tips">如果您没注册{conf site_name}帐号，也不想注册，那么您也可以通过下面第三方帐号直接进行登录。</p>
		</div>
    <p class="u-tips"></p>
    <div class="others"> 
		{if $this->Config[sina_enable] && sina_weibo_init()} &nbsp;{eval echo sina_weibo_login('b');} {/if}
		{if $this->Config[qqwb_enable] && qqwb_init()} &nbsp; {eval echo qqwb_login('b');} {/if}
		{if $this->Config[yy_enable] && yy_init()} &nbsp; {eval echo yy_login('b');} {/if}
		{if $this->Config[renren_enable] && renren_init()} &nbsp; {eval echo renren_login('b');} {/if}
		{if $this->Config[kaixin_enable] && kaixin_init()} &nbsp;{eval echo kaixin_login('b');} {/if}
		{if $this->Config[fjau_enable] && fjau_init()} &nbsp;{eval echo fjau_login('b');} {/if}
    </div>
    
    </div>
    </div>
    
    
<!--{if $this->Config['seccode_enable']==1 && $this->Config['seccode_login']}-->
<script language="javascript">$(document).ready(function(){$("#seccode_input").blur(function(){checkSeccode($("#seccode_input").val(), {"tips_id":"log_seccode_tips"});});});</script>
<!--{/if}-->

<script type="text/javascript">
function get_seccode(t){var s_id='';if('reg'==t){s_id=t+'_';}if($("#"+t+"_seccode").html()==''){seccode({"id":s_id+"seccode_input","wp":t+"_seccode","img_id":t+"_image_seccode"});$("#"+t+"_seccode_h").show();}}
function logincheckUsername(username){
	if(!username || username == ''){
		$('#username_tip').html('请输入帐号');
		$('#username_tip').show();
		$('#username_input').css({'background-color':'#FDEFEF'});
		$('#username_tip').addClass('username_tip_error');
		$('#username_tip').css({'width':'auto','color':'#e76969'});
		$('.btn_login').attr('disabled',true);
		return false;
	}
	
	$.post(
	    'ajax.php?mod=member&code=checkuser',
	    {username:username},
	    function(d){
	    	if(d.done == false){
	    		$('#username_tip').html(d.msg);
	    		$('#username_tip').show();
				$('#username_input').css({'background-color':'#FDEFEF'});
				$('#username_tip').addClass('username_tip_error');
				$('#username_tip').css({'width':'auto'});
	    		$('.btn_login').attr('disabled',true);
				
	    	} else {
	    		$('#username_tip').show();
				$('#username_input').css({'background-color':'#fff'});
				$('#username_tip').removeClass('username_tip_error');
				$('#username_tip').css({'width':'25px','display':'inline','margin-top':'2px'});
	    		var html = "<img sr" + "c='" + d.msg+  "' onerror='javascript:faceError(this);'  class='u-reg-login'/>";
	    		$('#username_tip').html(html);
	    		$('.btn_login').attr('disabled',false);
	    	}
	    },
	    'json'
	)
}
/*
登录注册切换脚本
*/
$('.login_ajax_tab span').click(function(){ 
	$(this).addClass("selected").siblings().removeClass(); 
	$(".login_ajax_content > ul").eq($('.login_ajax_tab span').index(this)).show().siblings().hide();
	if($('.login_ajax_tab span').index(this)==1){$("#logmhtml").show();$("#regmhtml").hide();}else{$("#regmhtml").show();$("#logmhtml").hide();} 
});
</script>
<!--{if $isreg}-->
<script language="javascript">$(document).ready(function(){kreg_buttom();});</script>
<!--{/if}-->